<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增问答管理')"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: jquery-smartwizard-css"/>
    <link rel="stylesheet" href="/js/kindeditor/themes/default/default.css"/>
    <link rel="stylesheet" href="/js/kindeditor/plugins/code/prettify.css"/>

    <script charset="utf-8" src="/js/kindeditor/kindeditor-all.js"></script>
    <script charset="utf-8" src="/js/kindeditor/plugins/code/prettify.js"></script>
    <script charset="utf-8" src="/js/kindeditor/lang/zh-CN.js"></script>
    <style>
        .contain {
            width: 94%;
            margin-left: 30px;
        }

        .qustitle {
            text-align: left;
        }

        .quespan {
            color: #00687D;
        }

        .white-bg {
            padding: 32px !important;
        }

        .layui-tab {
            position: relative;
        }

        .layui-btn {
            background: #E6F8FA !important;
            color: #02B7CA !important;
            position: absolute;
            right: 0px;
            top: -10px;
            z-index: 99;
        }
    </style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-question-add">
        <div class="contain tab-content">
            <div id="tab-1" class="tab-pane active" style="padding: 20px">
                <div class="form-group">
                    <div class="col-sm-12">
                        <label class="col-sm-1 control-label is-required">问题标题:</label>
                        <div class="col-sm-11">
                            <textarea name="name" id="name" placeholder="请输入问题标题" class="form-control"
                                      required></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<th:block th:include="include :: jquery-smartwizard-js"/>
<script src="/ueditor/ueditor.config.js" type="text/javascript" charset="utf-8"></script>
<script src="/ueditor/ueditor.all.js" type="text/javascript" charset="utf-8"></script>
<script src="/ueditor/lang/zh-cn/zh-cn.js" type="text/javascript" charset="utf-8"></script>
<script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
<script th:inline="javascript">
    $(document).ready(function () {
        $(".sortable-list").sortable({connectWith: ".connectList"}).disableSelection()
    });

    $(document).ready(function () {
        parent.$('body').find('.layui-layer-max').click()
    })

    var prefix = ctx + "ydz/question"

    $("#form-question-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        var myForm = $('#form-question-add');
        var formData = myForm.serializeArray();
        var json = {};
        $.each(formData, function (k, v) {
            json[v.name] = v.value;
        });

        var value = JSON.stringify(json)

        save1(prefix + "/addQustionByAi", value);
    }

    function save1(url, data, callback) {
        var config = {
            url: url,
            type: "post",
            dataType: "json",
            data: data,
            headers: {
                'Content-Type': 'application/json;charset=utf8'
            },
            beforeSend: function () {
                $.modal.loading("正在处理中，请稍候...");
                $.modal.disable();
            },
            success: function (result) {
                if (typeof callback == "function") {
                    callback(result);
                }
                $.operate.successCallback(result);
            }
        };
        $.ajax(config)
    }

</script>
</body>
</html>